package com.tencent.ied.bk.filter.impl;

import com.tencent.ied.bk.constant.CommonConstant;
import com.tencent.ied.bk.entity.BaseAbstractInfo;
import com.tencent.ied.bk.filter.AbstractFilter;

/**
 * @author chen_yu
 * @date 2021/3/11 3:09
 */
public class WordLengthFilter extends AbstractFilter {

    public WordLengthFilter(String name) {
        super(name);
    }

    @Override
    public boolean doFilter(BaseAbstractInfo baseAbstractInfo) {
        //判断每个单词的字母数是否在50个之内
        for (String word : baseAbstractInfo.getWords()) {
            if (word.length() > CommonConstant.SINGLE_WORD_LENGTH_LIMIT) {
                return false;
            }
        }
        return true;
    }
}
